/**
 * Created by zhaoguanghua on 16/3/30.
 */
var mongoose  = require('mongoose');
var BaseModel = require("./base_model");
var Schema    = mongoose.Schema;

var WorkspaceSchema = new Schema({
    work_name: { type: String, required:true},
    project_id:{type:Schema.Types.ObjectId, ref:'Project'},
    //project_id:{type:String},
    dependencies:{type:[{}]},
    //多工作空间时，记录用户和工作空间之间的关系
    user:{type:[{}]},
    create_at: { type: Date, default: Date.now },
    update_at: { type: Date, default: Date.now }
});

WorkspaceSchema.plugin(BaseModel);

//WorkspaceSchema.index({work_name: 1}, {unique: true});

module.exports = mongoose.model('Workspace', WorkspaceSchema);
